package com.ruoyi.utils;

import java.util.List;

/**
 * 解析数组工具类
 *
 * @author Mr-Le
 */
public class ParseArray {

    /**
     * 解析数组，"[[3061, 1869, 3125, 1942], [2577, 1477, 2633, 1609]]"
     * List<int[]> -----------> String
     *
     * @param ints list对象
     * @return String
     */
    public static String parseArrayList(List<int[]> ints) {
        StringBuilder builder = new StringBuilder();
        builder.append("[");
        for (int[] anInt : ints) {
            builder.append("[");
            for (int i = 0; i < anInt.length; i++) {
                builder.append(anInt[i]);
                if (i != anInt.length - 1) {
                    builder.append(",");
                }
            }
            builder.append("],");
        }
        builder.append("]").deleteCharAt(builder.length() - 2);
        return builder.toString();
    }

}
